#include "RGBPcm2Mp4Window.h"
#include <QFileDialog>
#include <QMessageBox>

RGBPcm2Mp4Window::RGBPcm2Mp4Window(QWidget *parent)
	: QWidget(parent)
{
	ui.setupUi(this);
	this->setWindowTitle("RGB、PCM生成MP4");
}

void RGBPcm2Mp4Window::choiceRGB()
{
	QString mPath = QFileDialog::getOpenFileName(nullptr, "请选择RGB文件", "E:\\BaiduNetdiskDownload\\test_resource", "媒体文件(*.*)");
	ui.rgbEdit->setText(mPath);
}
void RGBPcm2Mp4Window::choicePcm()
{
	QString mPath = QFileDialog::getOpenFileName(nullptr, "请选择PCM文件", "E:\\BaiduNetdiskDownload\\test_resource", "媒体文件(*.*)");
	ui.pcmEdit->setText(mPath);
}
void RGBPcm2Mp4Window::choiceMp4()
{
	QString mPath = QFileDialog::getSaveFileName(nullptr, "请选择MP4的输出路径", "E:\\BaiduNetdiskDownload\\test_resource", "媒体文件(*.*)");
	ui.mp4Edit->setText(mPath);
}
void RGBPcm2Mp4Window::startGenerate()
{
	QString rgbPath = ui.rgbEdit->text();
	QString pcmPath = ui.pcmEdit->text();
	QString mp4Path = ui.mp4Edit->text();
	if (rgbPath.isEmpty() || pcmPath.isEmpty() || mp4Path.isEmpty()) {
		QMessageBox::warning(this, "温馨提示", "输入、输出文件的路径不能为空");
		return;
	}
	RGBPcm2Mp4Controller::Get()->inputRGBFilePath = rgbPath;
	RGBPcm2Mp4Controller::Get()->inputPCMFilePath = pcmPath;
	RGBPcm2Mp4Controller::Get()->outMp4FilePath = mp4Path;
	RGBPcm2Mp4Controller::Get()->Start();
}


RGBPcm2Mp4Window::~RGBPcm2Mp4Window()
{

}
